package com.some;

import java.math.BigDecimal;

public class KeDa2 {
    public long getArea(Point p1, Point p2, Point p3, Point p4) {
        // write code here
        int x1 = p1.x;
        int y1 = p1.y;
        int x2 = p2.x;
        int y2 = p2.y;
        int x3 = p3.x;
        int y3 = p3.y;
        int x4 = p4.x;
        int y4 = p4.y;
        long s1 = (x1*y2+x2*y3+x3*y1-(x1*y3+x2*y1+x3*y2));
        long s2 = (x1*y3+x3*y4+x4*y1-(x1*y4+x3*y1+x4*y3));
        return (long) ((s1+s2)*0.5);
    }

    public long getArea2(Point p1, Point p2, Point p3, Point p4) {
        // write code here
        BigDecimal x1 = new BigDecimal(p1.x);
        BigDecimal y1 = new BigDecimal(p1.y);
        BigDecimal x2 = new BigDecimal(p2.x);
        BigDecimal y2 = new BigDecimal(p2.y);
        BigDecimal x3 = new BigDecimal(p3.x);
        BigDecimal y3 = new BigDecimal(p3.y);
        BigDecimal x4 = new BigDecimal(p4.x);
        BigDecimal y4 = new BigDecimal(p4.y);

        BigDecimal l1 = x1.multiply(y2);
        BigDecimal l2 = x2.multiply(y3);
        BigDecimal l3 = x3.multiply(y1);
        BigDecimal l4 = x1.multiply(y3);
        BigDecimal l5 = x2.multiply(y1);
        BigDecimal l6 = x3.multiply(y2);
        BigDecimal l7 = x1.multiply(y3);
        BigDecimal l8 = x3.multiply(y4);
        BigDecimal l9 = x4.multiply(y1);
        BigDecimal l10 = x1.multiply(y4);
        BigDecimal l11 = x3.multiply(y1);
        BigDecimal l12 = x4.multiply(y3);

        BigDecimal s1 = (l1.add(l2).add(l3).subtract(l4.add(l5).add(l6)));
        BigDecimal s2 = (l7.add(l8).add(l9).subtract(l10.add(l11).add(l12)));
        BigDecimal sum = (s1.add(s2)).divide(new BigDecimal(2));
        return sum.longValue();
    }
}

class Point {
    int x;
    int y;

    public Point(int x, int y) {
        this.x = x;
        this.y = y;
    }
}
